Mike: When building applications in the cloud,
how do you manage the traffic you may encounter
within a region?
Distributing traffic across multiple instances
of an application within a region
gains you high availability and fault tolerance.
This can dramatically improve performance
and user experience.
By spreading the load evenly,
you can avoid overloading individual instances,
minimize the impact of failures,
and improve resource use efficiency.
Azure provides two key services
for regional traffic distribution,
Azure Load Balancer and Azure Application Gateway.
These services offer different capabilities
and are suited for different scenarios,
which we are going to explore in detail
throughout this lesson.
Azure Load Balancer is a fundamental service
for distributing incoming traffic across multiple instances
of an application within a region.
It operates at layer four, the TCP/UDP, of the OSA model
and ensures that traffic is evenly distributed
among healthy backend instances.
There are two types of load balancers.
There's the public load balancer,
which distributes incoming internet traffic
to backend instances and provides a public IP address
and DNS name for the location,
and there's the internal load balancer,
which distributes traffic within a virtual network
and provides load balancing for internal services.
To configure Azure Load Balancer,
you define balancing rules that specify how traffic
should be distributed.
These rules determine the frontend IP configuration,
backend pool, and port mappings.
Additionally, health probes are used to monitor the health
of backend instances.
Load Balancer regularly checks the health of each instance
and routes traffic only to healthy instances.
Azure Load Balancer is commonly used for scenarios
that require scalability and high availability
for public facing applications.
It helps to distribute traffic evenly
so that optimal performance and resiliency
can be maintained as much as possible,
and it's also useful for load balancing internal services,
as we've mentioned, within a virtual network.
This could be something like a backend database
or an application tier,
where you're wanting to push data
that's on the front end of your application
towards the deeper architecture
and you have multiple instances of specific services
in that deeper architecture.
Load Balancer can help to distribute them evenly
there as well.
Azure Application Gateway is a service
for distributing regional application at layer seven
or HTTP/HTTPS layer.
It provides advanced routing and capabilities
as well as SSL termination or TLS, which makes it ideal
for load balancing web applications.
One of the key features of Application Gateway
is URL-based routing.
It allows you to route requests based on the URL paths,
enabling you to host multiple applications
on the same gateway.
This feature simplifies application deployment
and management, because you can use a single gateway
for multiple different applications and, as mentioned,
Application Gateway also supports SSL termination,
which offloads the SSL or TLS encryption
and decryption process from the backend servers.
So by handling SSL termination at the gateway level,
you can improve application performance
and reduce the load of backend servers.
Another significant advantage of Application Gateway
is the built-in web application firewall.
The WAF provides protection
against common web vulnerabilities,
such as SQL injection and cross-site scripting.
It offers customizable rules and protection policies,
which allow you to tailor the security measures
to your application's specific needs.
Application Gateway also supports autoscaling
and high availability right out of the box,
so it automatically scales based on the traffic load,
ensuring that your applications can handle
any level of demand.
It also provides built-in redundancy and fault tolerance.
Some common use cases for Azure Application Gateway
include securing and load balancing web applications,
hosting multiple websites on the same gateway,
and implementing advanced routing and SSL offloading.
Again, these are the most common cases
where an application gateway is one of the better
solutions over some of the other similar
or comparable solutions available in Azure.
So how do we choose the right traffic distribution solution?
The primary consideration is the application protocol.
If your application uses layer four protocols,
Azure Load Balancer is the suitable choice.
However, if your application relies on the layer seven
protocols and requires advanced routing capabilities,
Azure Application Gateway is usually the better option.
Other factors to consider include termination of your SSL,
whether you need a web application firewall.
Remember that Application Gateway provides
URL-based routing, SSL termination, and built-in WAF,
so if these are specific things that you need,
Application Gateway is usually the better choice.
Scalability and performance are also
important considerations.
Both services offer scalability options,
but Application Gateway provides additional features,
like autoscaling, which can help with specific types
of application performance.
When it comes to your best practices,
you want to design for high availability
and fault tolerance.
That is the point of these two services.
You want to configure your health probes and monitoring
to make sure that you know what's going on,
always wanting to secure your traffic
with SSL and TLS encryption.
Application Gateway provides that at its service level,
but that does not mean that you can't use it
with your load balancer.
It just means that if you're using Azure Load Balancer,
you still want to make sure that your traffic
is being secured with SSL and TLS encryption
and, as always, regularly test and validate
the traffic distribution setup.
It is entirely possible that you may start
with one solution and down the road realize
that it is not the ideal solution anymore.
Any good architect evaluates their design
around the changing needs of the specific environment.
Let's look at a real world scenario from globalBuy,
which is a global e-commerce company
and they're experiencing high traffic volumes
and want to distribute their application traffic
within each region to ensure high availability,
scalability, and optimal performance.
At this point, pause the video.
Take a moment to read over the scenario
and the requirements, and when you're ready,
resume and we'll go over the solution.
To meet the requirements, globalBuy can implement
Azure Application Gateway for regional traffic distribution.
They can configure HTTP and TTPS listeners
to handle incoming traffic
and define URL-based routing rules to direct requests
to the appropriate backend services.
With SSL termination, they can offload encryption
and decryption so that their applications
aren't having to do that.
Neither is the rest of the backend servers
for their applications.
To protect against common web vulnerabilities,
they can use a web application firewall.
They can also configure autoscaling
to automatically adjust the number of instances
of their application based on the traffic load
and deploy an application gateway across multiple
availability zones to make sure
that the application gateway itself is always functional.
They'll also use Azure Load Balancer
for distributing traffic on their backend services
within each availability zone.
This is one rather straightforward way of a company
in the real world that may need to do just some basic
or rather straightforward load balancing
that brings some additional features that simplifies
the application architecture.
If they're relying on things like SSL
encryption and decryption in the application gateway,
it simplifies how they do things on the backend.
Having a load balancer on the back end to make sure
that their databases or their Redis caches
or anything else that they have multiple instances of
are being evenly distributed across the regions.
Again, all of these little things can add up
to sometimes significant or small performance increases
that, when brought together as a whole,
can dramatically improve a customer's
application configuration.
Thanks for being with me in this video.
I hope it's been helpful and I'll see you in the next one.